<template>
  <div class="typeAll">
    <ul>
      <li v-for="banner in banners" :key="banners" @click="toMore(banner.id)">
        <img :src="`http://121.199.173.91/assets/images/${banner.icon}`" alt="">
        <p>{{banner.name}}</p>
      </li>
    </ul>
  </div>
</template>

<script>
import request from "@/request";

export default {
  name:"Type",
  data(){
    return{
      banners:[],
    }
  },
  methods:{
    toMore(id){
      this.$router.push({path:"/more",query:{bannerId:id}})
    },
    loadBaseData(){
      request({
        method:"get",
        url:"/banner-service/banner/getInfo",
      }).then((respData) => {
        if(respData.code == 200){
          this.banners = respData.data;
          console.log(respData.data);
        }else{
          console.log(respData.msg);
        }
      }).catch((error) => {
        console.error(error)
      })
    }
  },
  created(){
    this.loadBaseData();
  }
}
</script>

<style scoped>
.typeAll{

}
.typeAll ul{
  box-sizing: border-box;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding-bottom: 5vw;
}
.typeAll ul li{
  box-sizing: border-box;
  width: 20%;
  text-align: center;
}
.typeAll ul li img{
  /* 取消图片拖动 */
  -webkit-user-drag: none;
  width: 60%;
  padding: 5vw 10% 0 10%
}
.typeAll ul li p{
  font-size: 3vw;
  color: gray;
}
</style>